﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace VAdvantage.UIEvent
{
    public class Events
    {
        private Events() { } //prevent from creation

        /** The onClick event (used with {@link MouseEvent}).
         */
        public const String ON_CLICK = "onClick";
        /** The onRightClick event (used with {@link MouseEvent}).
         */
        public const String ON_RIGHT_CLICK = "onRightClick";
        /** The onDoubleClick event (used with {@link MouseEvent}).
         */
        public const String ON_DOUBLE_CLICK = "onDoubleClick";
        /** The onOK event (used with {@link KeyEvent}).
         */
        public const String ON_OK = "onOK";
        /** The onCancel event (used with {@link KeyEvent}).
         */
        public const String ON_CANCEL = "onCancel";
        /** The onCtrlKey event (used with {@link KeyEvent}).
         */
        public const String ON_CTRL_KEY = "onCtrlKey";
        /** The onChange event (used with {@link InputEvent}).
         */
        public const String ON_CHANGE = "onChange";
        /** The onChanging event (used with {@link InputEvent}).
         */
        public const String ON_CHANGING = "onChanging";
        /** The onError event (used with {@link ErrorEvent}).
         */
        public const String ON_ERROR = "onError";
        /** The onScroll event (used with {@link ScrollEvent}).
         */
        public const String ON_SCROLL = "onScroll";
        /** The onScrolling event (used with {@link ScrollEvent}).
         */
        public const String ON_SCROLLING = "onScrolling";
        /** The onSelect event (used with {@link SelectEvent}).
         */
        public const String ON_SELECT = "onSelect";
        /** The onSelection event (used with {@link SelectionEvent}).
         */
        public const String ON_SELECTION = "onSelection";
        /** The onCheck event (used with {@link CheckEvent}).
         */
        public const String ON_CHECK = "onCheck";
        /** The onMove event (used with {@link MoveEvent}).
         */
        public const String ON_MOVE = "onMove";
        /** The onSize event (used with {@link SizeEvent}).
         */
        public const String ON_SIZE = "onSize";
        /** The onZIndex event (used with {@link ZIndexEvent}).
         */
        public const String ON_Z_INDEX = "onZIndex";
        /** The onOpen event (used with {@link OpenEvent}).
         */
        public const String ON_OPEN = "onOpen";
        /** The onClose event (used with {@link Event})
         * used to denote the close button is pressed.
         */
        public const String ON_CLOSE = "onClose";
        /** The onRender event (used with {@link org.zkoss.zk.ui.ext.client.RenderOnDemand}).
         */
        public const String ON_RENDER = "onRender";
        /** The onTimer event (used with {@link Event}).
         * Sent when a timer is up.
         */
        public const String ON_TIMER = "onTimer";
        /** The onFocus event (used with {@link Event}).
         * Sent when a component gets a focus.
         */
        public const String ON_FOCUS = "onFocus";
        /** The onBlur event (used with {@link Event}).
         * Sent when a component loses a focus.
         */
        public const String ON_BLUR = "onBlur";
        /** The onDrop event (used with {@link DropEvent}).
         * Sent when a component is dragged and drop to another.
         */
        public const String ON_DROP = "onDrop";
        /** The onNotify event (used with {@link Event}).
         * It is not used by any component, but it is, rather, designed to
         * let users add customized events.
         */
        public const String ON_NOTIFY = "onNotify";
        /** The onSort event (used with {@link Event})
         * to notify a request for sorting.
         */
        public const String ON_SORT = "onSort";
        /** The onUpload event (used with {@link UploadEvent}.
         */
        public const String ON_UPLOAD = "onUpload";
        /** The onBookmarkChange event (used with {@link BookmarkEvent})
         * to notify that user pressed BACK, FORWARD or specified URL directly
         * that causes the bookmark is changed (but still in the same desktop).
         * <p>All root components of all pages of the desktop will
         * recieve this event.
         * @since 3.0.8
         */
        public const String ON_BOOKMARK_CHANGE = "onBookmarkChange";
        /** @deprecated As of release 3.0.8, replaced with {@link #ON_BOOKMARK_CHANGE}.
         */
        public const String ON_BOOKMARK_CHANGED = "onBookmarkChanged";
        /** The onURIChange event (used with {@link URIEvent})
         * to notify that the associated URI of a component is changed.
         * Currently only the iframe component supports this event.
         * @since 3.5.0
         */
        public const String ON_URI_CHANGE = "onURIChange";
        /** The onClientInfo event (used with {@link ClientInfoEvent}).
         */
        public const String ON_CLIENT_INFO = "onClientInfo";

        /** The onCreate event (used with {@link CreateEvent}) to notify a compoent
         * that it (and its children) has been created by ZK's evaluating a ZUML page.
         */
        public const String ON_CREATE = "onCreate";
        /** The onModal event (used with {@link Event}) to notify a component
         * shall become modal. Currently, only ZUL's window components support it.
         */
        public const String ON_MODAL = "onModal";
        /** The onPiggyback event (used with {@link Event}) used to notify
         * a root component that the client has sent a request to the server.
         * It is meaningful only if it is registered to the root component.
         * Once registered, it is called
         * each time the client sends a request to the server.
         * The onPiggyback's event listener is processed after all other
         * events are processed.
         *
         * <p>The onPiggyback event is designed to let developers piggyback
         * the least-emergent UI updates to the client.
         *
         * @since 2.4.0
         */
        public const String ON_PIGGYBACK = "onPiggyback";

        /** The onUser event. It is a generic event that an application developer
         * might send from the client. ZK doesn't use this event.
         */
        public const String ON_USER = "onUser";

        /** The onMinimize event (used with {@link MinimizeEvent}).
         * @since 3.5.0
         */
        public const String ON_MINIMIZE = "onMinimize";

        /** The onMaximize event (used with {@link MaximizeEvent}).
         * @since 3.5.0
         */
        public const String ON_MAXIMIZE = "onMaximize";

        /** The onFulfill event (used with {@link FulfillEvent})
         * to denote a fulfill condition has been applied.
         * Developer usually listens to this event to process the
         * new created children. For example, you might invoke
         * {@link org.zkoss.zk.ui.Components#wireFellows} to process these new components.
         * @since 3.0.8
         */
        public const String ON_FULFILL = "onFulfill";

        /** Returns whether an event name is valid.
         *
         * <p>The event name must start with on and the third character
         * must be upper case.
         */
        public static bool IsValid(String name)
        {
            return name != null && name.Length > 2
                && name[0] == 'o' && name[1] == 'n'
                && char.IsUpper(name[2]);
        }
    }
}
